
const {getIndexHttp} = require("../../utils/http")
Page({
  data: {
    musics:[],
    offset:0
},
onLoad: function (options) {
    var offset = this.data.offset;
    getIndexHttp(offset).then(res=>{
        var musics = res.data.playlists;
        this.setData({
            musics
        })
    })
},
onReachBottom(){
    console.log("bottom")
    var offset = this.data.offset;
    offset+=20;
    getIndexHttp(offset).then(res=>{
      var musics = this.data.musics;
      musics.push(...res.data.playlists);
      this.setData({
        musics,
        offset
      })
    })
}
})
